<style media="print">
    @page {
        size: auto;
        margin: 0mm;
    }
    body {
        font-size: 15px
    }
    .table th , .table td{
        border: 1px solid black;
    }
    /*.no-print{*/
    /*    //display: none;*/
    /*}*/
</style>
<div class="panel panel-default panel-intro">

    <div class="panel-heading">
        {:__('Info')}
    </div>
    {if condition="$detail neq null "}

    <div class="panel-body newrow prindBody">
        <div class="row">
            <div class="col-md-4 col-xs-12 form-group code">
                <label class="control-label col-xs-12 col-sm-3">{:__('Code')}:</label>
                <div class="col-xs-12 col-sm-6">
                    {$detail[0]['code']}
                </div>
            </div>
            <div class="col-md-4 col-xs-12 form-group print-row">
                <label class="control-label col-xs-12 col-sm-3">{:__('Supplier')}:</label>
                <div class="col-xs-12 col-sm-6">
                    {$detail[0]['supplier']['name']}
                </div>
            </div>
            <div class="col-md-4 col-xs-12 form-group print-row">
                <label class="control-label col-xs-12 col-sm-3">{:__('Contact')}:</label>
                <div class="col-xs-12 col-sm-6">
                    {$detail[0]['contact']}
                </div>
            </div>
            <div class="col-md-4 col-xs-12 form-group print-row">
                <label class="control-label col-xs-12 col-sm-3">{:__('Phone')}:</label>
                <div class="col-xs-12 col-sm-6">
                    {$detail[0]['phone']}
                </div>
            </div>
            <div class="col-md-4 col-xs-12 form-group print-row">
                <label class="control-label col-xs-12 col-sm-3">{:__('Delivery')}:</label>
                <div class="col-xs-12 col-sm-6">
                    {$detail[0]['delivery_time']|date="Y-m-d",###}
                </div>
            </div>
            <div class="col-md-4 col-xs-12 form-group print-row">
                <label class="control-label col-xs-12 col-sm-3">{:__('Purchase order')}:</label>
                <div class="col-xs-12 col-sm-6">
                    {$detail[0]['purchase_code']}
                </div>
            </div>
            <div class="col-md-4 col-xs-12 form-group print-row">
                <label class="control-label col-xs-12 col-sm-3">{:__('Type')}</label>
                <div class="col-xs-12 col-sm-6">
                    {:__("Type ".$detail[0]['the_way'])}

                </div>
            </div>
            <div class="col-md-4 col-xs-12 form-group print-row">
                <label class="control-label col-xs-12 col-sm-3">{:__('Status')}:</label>
                <div class="col-xs-12 col-sm-6">
                    {:__("Status ".$detail[0]['status'])}

                </div>
            </div>
            {if condition="$detail[0]['status'] eq 2"}
            <div class="col-md-4 col-xs-12 form-group print-row">
                <label class="control-label col-xs-12 col-sm-4">{:__('Reason for failure')}:</label>
                <div class="col-xs-12 col-sm-6">
                    {$detail[0]['reason']}
                </div>
            </div>
            {/if}

            <div class="col-md-4 col-xs-12 form-group print-row">
                <label class="control-label col-xs-12 col-sm-3">{:__('Billing')}:</label>
                <div class="col-xs-12 col-sm-6">
                    {$detail[0]['billing_time']|date="Y-m-d",###}
                </div>
            </div>
            <div class="col-md-12 col-xs-12 form-group print-row">
                <label class="control-label col-xs-12 col-sm-1">{:__('Address')}:</label>
                <div class="col-xs-12 col-sm-10">
                    {$detail[0]['city']}{$detail[0]['address']}

                </div>
            </div>
            <div class="col-md-4 col-xs-12 form-group print-remark">
                <label class="control-label col-xs-12 col-sm-3">{:__('Remark')}:</label>
                <div class="col-xs-12 col-sm-6">
                    {$detail[0]['remark']}
                </div>
            </div>
            {if condition="$detail[0]['status'] eq 2"}
            <div class="col-md-12 col-xs-12 form-group print-remark">
                <label class="control-label col-xs-12 col-sm-1" style="color: red">{:__('Reason for failure')}:</label>
                <div class="col-xs-12 col-sm-11">
                    {$detail[0]['reason']}
                </div>
            </div>
            {/if}
        </div>
        <div class="table-responsive">
            <table class="table table-striped">
                <tr>
                    <th>{:__('Serial number')}</th>
                    <th>{:__('Sku')}</th>
                    <th>{:__('Commodity')}</th>     
                    <th>{:__('Specification')}</th>
                    <th>{:__('Attributes')}</th>
                    <th>{:__('Unit')}</th>
                    <th>{:__('Storage Quantity')}</th>
                    <th>{:__('unit price')}</th>
                    <th>{:__('Subtotal')}</th>
                    <th>{:__('Remarks')}</th>
                </tr>
                {if condition="$product neq null"}
                {volist name="product" id="vo" key="k"}
                <tr>
                    <td>{$k}</td>
                    <td>{$vo.products['sku']}</td>
                    <td>{$vo.products['name']}</td>
                    <td>{$vo.products['specification']}</td>
                    <td>
                        {volist name="$vo.products['prop']" id="val"}
                        {$val.title}:{:isset($val['value'])?$val['value']:""}
                        {/volist}
                    </td>
                    <td>{$vo.products.unit}</td>
                    <td>{$vo.nums}</td>
                    <td>{$vo.price}</td>
                    <td>{$vo.subtotal}</td>
                    <td>{$vo.remark}</td>
                </tr>
                {/volist}
                {/if}
                <tr>
                    <td>{:__('Total')}</td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td>{$detail[0]['totalNums']}</td>
                    <td></td>
                    <td>{$detail[0]['money']}</td>
                    <td></td>
                </tr>

            </table>
        </div>
        <div style="padding-top: 20px;">
            <div class="row">
                <div  class="control-label col-xs-12 col-sm-12">


                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div  class="col-md-12 col-xs-12 form-group no-print" style="text-align: right;">
            <a class="btn btn-default" onclick="printPdf()" role="button">打印</a>
            {if condition="$detail[0]['status'] eq 0"}
            <a class="btn btn-default {:$auth->check('ykjp/purchase/storage/edit')?'':'hide'}" href="{:url('/ykjp/purchase/storage/edit',array('ids'=>$detail[0]['id']))}" role="button">{:__("Edit")}</a>
            <a class="btn btn-default {:$auth->check('ykjp/purchase/sto_audit/approval')?'':'hide'}" onclick="approval('yes', {$detail[0]['id']})"   role="button">{:__('Approved yes')}</a>
            <a class="btn btn-default {:$auth->check('ykjp/purchase/sto_audit/approval')?'':'hide'}" onclick="appWhy({$detail[0]['id']})"  role="button">{:__('Approved no')}</a>
            {/if}
            {if condition="$detail[0]['status'] eq 1"}

            <a class="btn btn-default {:$auth->check('ykjp/purchase/sto_audit/approval')?'':'hide'}" onclick="storage({$detail[0]['id']})"  role="button">{:__('Confirm storage')}</a>

            {/if}
            {if condition="$detail[0]['status'] eq 1 or ($detail[0]['status'] eq 2 and $detail[0]['purchase_id'] eq 0)"}

            <a class="btn btn-default {:$auth->check('ykjp/purchase/storage/inventory')?'':'hide'}" onclick="Anti({$detail[0]['id']})"  role="button">{:__('Anti audit')}</a>
            {/if}

        </div>
    </div>

</div>
</div>

{/if}
